// Copyright by Thomas Maierhofer / MSE-iT, Hauptstrasse 32, 88427 Bad Schussenried, Germany
// See licence file of project for licencing details
// Contact: thomas@maierhofer.de



#include "stdafx.h"
#include "..\resource.h"
#include "WelcomePage.h"


// CWelcomePage-Dialogfeld

IMPLEMENT_DYNAMIC(CWelcomePage, CDialog)

CWelcomePage::CWelcomePage(CWnd* pParent /*=NULL*/)
	: CWizardPage("welcome.bmp", CWelcomePage::IDD, pParent)
{
}

CWelcomePage::~CWelcomePage()
{
}

void CWelcomePage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_LANGUAGE_COMBO, m_LanguageCombo);
	DDX_Control(pDX, IDC_LANGUAGE_STATIC, m_LanguageStatic);
	DDX_Control(pDX, IDC_WELCOME_RICHEDIT, m_GreetingText);
}


BEGIN_MESSAGE_MAP(CWelcomePage, CWizardPage)
	ON_CBN_SELCHANGE(IDC_LANGUAGE_COMBO, &CWelcomePage::OnCbnSelchangeLanguageCombo)
END_MESSAGE_MAP()


BOOL CWelcomePage::OnCreatePage()
{
	CWizardPage::OnCreatePage(); // Never forget to call the base class method

	m_LanguageCombo.AddString("English");
	m_LanguageCombo.AddString("German");
	m_LanguageCombo.SetCurSel(0);
	return TRUE;
}

void CWelcomePage::LocalizeControls( void )
{
	CWizardPage::LocalizeControls(); // Never forget to call the base class method
	m_LanguageStatic.SetWindowText(CSetupApp::SetupApp->Messages[WELCOME_LANGUAGE_STATIC]);
	m_GreetingText.SetRtfText(CSetupApp::SetupApp->GetLocalizedTextResource("welcome.rtf")); 

}

// CWelcomePage-Meldungshandler

void CWelcomePage::OnCbnSelchangeLanguageCombo()
{
	int sel = m_LanguageCombo.GetCurSel();
	switch( sel )
	{
	case 0: CSetupApp::SetupApp->SetLanguagePrefix("EN"); break;
	case 1: CSetupApp::SetupApp->SetLanguagePrefix("DE"); break;
	}


}
